package com.company;

/**
 * @author 杨东
 */
public class InheritTest {
    static  class  Person{
        protected String name;
        protected   int age;

        public String getName() {
            return name;
        }

        @Override
        public String toString() {
            return "Person{" +
                    "name='" + name + '\'' +
                    ", age=" + age +
                    '}';
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }
        public  void  hello(String name){
            String  s=name;
            System.out.println(s);
        }
    }
    static  class  Student extends Person{
//        private String name;
//        private int age;
        private int score;

        @Override
        public String toString() {
            return "Student{" +
                    "score=" + score + "name='" + name+
                    '}';
        }

        public int getScore() {
            return score;
        }

        public void setScore(int score) {
            this.score = score;
        }
    }

    public static void main(String[] args) {
         Student s= new Student();
         s.hello("yd");
         s.setName("ty");
         s.setScore(12);
         System.out.println(s.toString());
    }
}
